<?php
    $conn = new mysqli('localhost', 'root', 'root', 'sy2108');

    if ($conn -> connect_error) {
        die('连接错误');
    }

    $num = $_GET['num'];
    $limit = $_GET['limit'];
    $txt = $_GET['txt'];

    $start = ($num - 1) * $limit;

    $sql = "SELECT * FROM `list`  WHERE `list_name` LIKE '%$txt%' LIMIT $start, $limit";

    $res = $conn -> query($sql);


    $arr = array();

    while ($obj = mysqli_fetch_assoc($res)) {
        array_push($arr, $obj);
    }

    echo json_encode($arr);
?>